import QtQuick 2.0
import org.qtproject.qtquick 1.0

import "../delegate"
import "../common"
import "../page"


BorderImage {
    id: id_messageRecieved
    width: id_txtMessageReceived.contentWidth + m_margin * 2
    height: id_txtMessageReceived.contentHeight + m_margin

    property int m_maxWidth: id_conversationDelegate.width - id_avatar.width - id_timeReceived.width - m_margin * 2;
    property bool m_visibleTime: false;
    property int m_margin: 30 * m_ratio

    property string soruce_image: "qrc:/images/resources/box-chat/box_chat_friend@2x.png"
    property string soruce_imageCombine: "qrc:/images/resources/box-chat/box_chat_friend@2x_combine.png"

    border {
        left: m_margin * m_ratio;
        top: 5 * m_ratio;
        right: 5 * m_ratio;
        bottom: 5 * m_ratio
    }

    source: combinedMessage === true ? soruce_image : soruce_imageCombine

    Column {
        id: id_columnMessage
        anchors.verticalCenter: parent.verticalCenter

        x: m_margin

        Text {

            id: id_txtMessageReceived
            width: m_maxWidth

            text: txtMessage
            color: "#000000"

            font.family: "Arial"
            wrapMode: Text.WordWrap
            font.pixelSize: 20 * m_ratio;
        }
    }

//    MouseArea {
//        anchors.fill: id_messageRecieved
//        onClicked: {
//            if (m_visibleTime === false) {
//                m_visibleTime = true;
//                id_messageRecieved.height = id_txtMessageReceived.contentHeight  + id_time.contentHeight + m_margin * m_ratio
//            } else {
//                m_visibleTime = false;
//                id_messageRecieved.height = id_txtMessageReceived.contentHeight + m_margin * m_ratio
//            }
//        }
//    }

}

